package com.huike.web.controller.business;

import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.domain.vo.BusinessTrackVo;
import com.huike.business.service.TbBusinessTrackRecordService;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: fwh
 * @Date: 2023/07/13/8:41
 * @Description:
 */
@Controller
@RequestMapping("/busines/record")
public class TbBusinessTrackRecordController extends BaseController {

    @Resource
    private TbBusinessTrackRecordService tbBusinessTrackRecordService;

    /**
     * 新增商机跟进记录
     * @param businessTrackVo
     * @return
     */
    @PostMapping
    public AjaxResult add(@RequestBody BusinessTrackVo businessTrackVo){

        return  toAjax(tbBusinessTrackRecordService.add(businessTrackVo));
    }

    /**
     * 查询商机跟进记录列表
     * @param id
     * @return
     */
    @GetMapping("/list")
    public AjaxResult list(@RequestParam("businessId") Long id ){
        return AjaxResult.success(tbBusinessTrackRecordService.getBusinessTrackRecord(id));
    }

    /**
     * 获取商机跟进记录详细信息
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public AjaxResult getById(@PathVariable Long id) {
        TbBusinessTrackRecord tbBusinessTrackRecord = tbBusinessTrackRecordService.getById(id);
        return AjaxResult.success(tbBusinessTrackRecord);
    }
}
